using Jupiter.Infrastructure.Security;
using Wips.AppService.CommonViewModels;
using Wips.Domain.Models.Authorities.Model;

namespace Wips.AppService.Authorities.Users.ViewModels
{
    /// <summary>
    /// [用户]数据传输对象
    /// </summary>
    public class UserViewModel : ViewModelBase
    {
        /// <summary>
        /// 用户名
        /// </summary>
        public string UserName { get; set; }

        /// <summary>
        /// 真实姓名（渠道名称）
        /// </summary>
        public string RealName { get; set; }

        /// <summary>
        /// 密码
        /// </summary>
        public string? Password { get; set; }


        /// <summary>
        /// 手机号
        /// </summary>
        public string PhoneNumber { get; set; }

        /// <summary>
        /// 电子邮箱
        /// </summary>
        public string? Email { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        public Status Status { get; set; }

    


        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public string ToString11()
        {
            return $"{RealName},{UserName},{PhoneNumber},{Email}";
        }

        /// <summary>
        /// 密码是否相等
        /// </summary>
        /// <param name="password"></param>
        /// <returns></returns>
        public bool PasswordEquals(string password)
        {
            return PasswordHash.ValidatePassword(password, Password);
        }

        /// <summary>
        /// 是否已启用
        /// </summary>
        /// <returns></returns>
        public bool IsEnabled()
        {
            return Status == Status.Enabled;
        }
    }
}